-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Close files in SD manipulation functions #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks :) |
That should not be necessary unless there is a leak in the abstraction. According to my understanding VFSFileImpl runs "close" within its destructor. The compiler supplied implementation of fs::File destructor will reduce the refcount of the shared_ptr which should be zero then. So that should trigger the vritual destructor of FileImpl which is implemented as close() within VFSFileImpl. So the effect should be the same, and this change will at best only confuse users or lead to odd user code. |
On a second look the close method should not even exist.. |
It is part of the standard Arduino API ;) |
make a new one :) But is my observation correct that the change does not fix a problem? |
Could be, maybe that's why I did not add it to the samples, but then I did not have this issue at all... so... SD seems weird at times depending on the card and others |
I wasn't aware of that thing about the FS destructor. I noticed that I had an error which disappeared after I added `file.close()`. Haven't thoroughly tested though so it might be just redundant code indeed and some instability caused by the SD itself triggered the error.
…On Jul 17, 2017, 15:35 +0800, Andreas Pokorny , wrote:
make a new one :)
But is my observation correct that the change does not fix a problem?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Ok now I am very curious what type of problems you had One thing to note with the API is that:
because the file stream for writing will be closed after another stream was opened. Maybe thats the reason why File::close exists.. |
No description provided.